USE OUTDOOR
GO

if exists (select *  from sysobjects where name ='EmployeeLoad') drop procedure  EmployeeLoad
go
-- exec EmployeeLoad @ID ='Face0',@Login=''
CREATE PROCEDURE [dbo].[EmployeeLoad](@ID VARCHAR(36)=null, @Login varchar(max) = '')
AS
BEGIN
	select 
		ObjectXml  
	from 
		dbo.vStorage 
	where
		(vStorage.id=@ID	or 	@ID is null)
		and 
		(
		(TagName='Employeer'	
		and 
		id in(
					select ObjectId from 
						dbo.vSrchObjectPropertyStorage 
					where 
						PropertyName='Login' 
						and PropertyValue=@Login 						
					)
			)or 	@Login = '')

END		

GO

